package com.ourway;

import com.facebook.Session;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;

public class SplashActivity extends Activity {
	
	private final int SPLASH_DISPLAY_LENGTH = 1000;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		
		//ActionBar actionBar = getActionBar();
		//actionBar.hide();
		
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				finish();
				Session session = Session.getActiveSession();
				if(session != null && !session.isOpened() && !session.isClosed()){				
					SplashActivity.this.startActivity(new Intent(SplashActivity.this, LoginActivity.class));
				}
				else {					
					SplashActivity.this.startActivity(new Intent(SplashActivity.this, MainActivity.class));
				}				
			}
		}, SPLASH_DISPLAY_LENGTH);
	}
	

}
